black = open("./black.dic","w")
black.write(" ")
black.close()
falg1 = 1
while falg1:
    print("请选择:1注册|2登录")
    type_input =int(input())
    if (type_input == 1):
        user_name = input("请输入用户名:")
        user_password = input("请输入用户密码:")

    elif (type_input==2):
         type_num=0
         falg2 = 1
         while falg2:
            user_name = input("请输入用户名:")
            user_password = input("请输入用户密码:")
            fhr = open("./black.dic", "r")
            for line1 in fhr.readlines():
                if line1==user_name:
                    print("非法登录")
                    falg2 = 0
                    falg1 = 0
                    break
                else:
                        fo=open("./user.dic","r")
                        for line in fo.readlines():
                            datas=line.split(":")
                            uname =  datas[0]
                            upwd = datas[1]
                            if user_name == uname and user_password == upwd:
                                print("登陆成功")
                                falg1 = 0
                                fo.close()
                                falg2 = 0
                            else:
                                print("用户名密码错误")
                                if type_num==2:
                                    fh = open("./black.dic","a")
                                    fh.write("\n"+user_name)
                                    fh.close()
                                type_num += 1
                                continue
